import { UserCollection , IUserCollection} from "./UserCollection";
 
export interface IIterator {
    hasMore(): boolean;
    getNext(): any;
}

export class Iterator implements IIterator{
    collection:IUserCollection;
    index:number = 0;
    constructor(collection:IUserCollection){
        this.collection = collection
    }

    hasMore(){
        return this.collection.getList().length-1 > this.index;
    }

    getNext<T>():T{
        return this.collection.getList()[this.index++]
    }
}